package zrweb;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//import org.mogoo.tools.ConnDB;

/**
 * Servlet implementation class TrafficWeb
 */
public class TrafficWeb extends HttpServlet 
{
	private static final long serialVersionUID = 1L;
	
    /**
     * @see HttpServlet#HttpServlet()
     */
    public TrafficWeb() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{
		// TODO Auto-generated method stub		
		// NOTE: to get the value of POINT
		String point = request.getParameter("point");

		if("login".equalsIgnoreCase(point))
		{
			Login login = new Login();
			login.getLogin(request, response);
		}//end of if login
		
		else if("logout".equalsIgnoreCase(point))
		{
			Logout logout = new Logout();
			logout.getLogout(request, response);
		}//end of if logout
		
		else if("location".equalsIgnoreCase(point))
		{
			Location location = new Location();
			location.getLocation(request, response);
		}//end of if location
		
		else if("enemyposition".equalsIgnoreCase(point))
		{
			EnemyPosition enemyPos = new EnemyPosition();
			enemyPos.getEnemyPos(request, response);
		}//end of if enemyposition
		
		else if("shoot".equalsIgnoreCase(point))
		{
			System.out.println("got shoot request");
			Shot shot = new Shot();
			shot.getShot(request, response);
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
